# Генерация обучающей выборки 
def genTrainingSet(prolog)
    component = [Component.new(@start_x,@end_x,@delta_x), 
				Component.new(@start_y,@end_y,@delta_y)]

    array = []
    s = ""
    0.upto(component.size - 1) do |i| 
        s += "component[#{i}].each do |c#{i}|\n"
    end
    s += "xy = []\n"

    0.upto(component.size - 1) do |i| 
        s += "xy += [c#{i}]\n"
    end
        
    s += 
        "
        stdin, stdout, stderr = Open3.popen3(\"swipl -s #{prolog}\");
        stdin.puts \"run("

    0.upto(component.size - 1) do |i| 
        s += "\#{c#{i}},"
    end


    s = s[0..-2]
    s +=
        ").\n\"
        stdin.close
        if stdout.readlines === [\"true.\n\"]
            v = 1
        else
            v = 0
        end
        stdout.close
        stderr.close
        array += [[xy[0], xy[1], v]]\n" 
    component.each do |c|
        s+= "end\n"
    end 

    eval s
    array
end
